<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button class="btn">点击跳转</button>
    <button class="colse">点击关闭</button>
    <button class="refresh">刷新</button>
</body>
<script>
    const wid = window.screen.width * window.devicePixelRatio;//获取屏幕宽度
    const hei = window.screen.height * window.devicePixelRatio;//获取屏幕高度
    console.log(wid,hei);//获取当前屏幕分辨率

//    let clis = window.confirm('confirm')
//    if(clis){
//        alert('可以正常退出了！')
//    }else{
//        alert('请重新确认！')
//    }
    // window.addEventListener('resize',function(){
    //     console.log(window.innerWidth,window.innerHeight);
        
    // });
    let btn = document.querySelector(".btn");
    // btn.addEventListener("click",function(){
    //     history.pushState('', {}, 'aaa');
    // })
    // console.log(screen.availHeight,screen.availWidth);//获取屏幕的宽度和高度
    // console.log(window.navigator.onLine);//判断是否联网 ---为true就是联网了；
    // console.log(window.navigator.platform);//通过platform可以判断浏览器所在的系统平台类型  简言之就是获取操作系统的位数
    // console.log(window.navigator.userAgent);//通过userAgent可以判断用户浏览器的类型
    // console.log(location);
    console.log("outerWidth 宽度：",window.outerWidth);
    // outerWidth 宽度： 1920
    console.log("outerHeight 高度：",window.outerHeight);
    // outerHeight 高度： 1040

    
    let win = null;
    btn.addEventListener('click',function(){
        win = window.open('https://www.baidu.com/','_blank','height=500,width=500,top=250%,left=500%,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');
        let timer = setInterval(() => {
        if (win.closed) {  //监听点击关闭新窗口事件；
            console.log(123);
            clearInterval(timer)
            timer = null;
        }
        }, 500)
    })
    
    let colse = document.querySelector(".colse");
    btn.addEventListener('click',function(){
    })

    let refresh = document.querySelector(".refresh");
    refresh.addEventListener('click',function(){
        window.location.reload(true);
    })
</script>
</html>